<!DOCTYPE html>
<html>
<head lang="zh-cn">
    <link href="$!{__beat.server.contextPath}/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="$!{__beat.server.contextPath}/bootstrap/datepicker/datepicker3.css" rel="stylesheet">
    <link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/css/App.css" type="text/css" />
    <link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/css/font-awesome.min.css" type="text/css" />
    
    <link rel="stylesheet" type="text/css" href="$!{__beat.server.contextPath}/css/wnl.css">
    <meta charset="UTF-8">
    
    <title>信息数据看板</title>
</head>
<body>

<div class="container-fluid">

    <div class="row" align="center" style="margin-bottom:8px; margin-top:5px;">
                <form class="form-inline" action="$!{__beat.server.contextPath}/info/postRate" method="post">
                        <div class="form-group" style="width:180px">
                            <label for="businessName" style="padding-left:15px;">业务线：</label>
                            <select id="businessName" name="businessName" class="form-control input-sm" style="align:center; width:100px; ">
                               #foreach($buss in $businessList)
                                    #if($buss != "total")
                                    <option value="$buss" #if("$buss" == $!businessName) selected #end>$business_CN_Map.get("$buss")</option>
                                    #end
                                #end  
                            </select>
                        </div>  
                        <div class="form-group">                       
                               <input type="submit" value="查询" class="btn btn-primary btn-xs">
                        </div>
                </form>
    </div>


 <!--    <div class="datacontent">
        <div class="dataTit">
            <i class="mark"></i><span>业务线发布成功率</span>
        </div>

        <div class="dataShow">
            <div id='platPostRateOption' dateGrp='stat_date' statType='day' indexType='info_valid_add_count'>
                <form class="form-inline">
                    <label for="beginDate_platPostRate">时间段: </label>
                    <div class="form-group input-group input-group-sm" style="width: 10%;">
                        <input id="beginDate_platPostRate" type="text"  class="form-control input-sm time" placeholder="选择起始时间" value="$!maxDate"/>
                    </div>
                    <label for="endDate_platPostRate"> ---  </label>
                    <div class="form-group input-group input-group-sm" style="width: 10%;">
                        <input id="endDate_platPostRate" type="text" class="form-control input-sm time" placeholder="选择结束时间" value="$!maxDate"/>
                     </div>

                    <button id="refresh_platPostRate_btn" type="button" class="btn btn-default form-control input-sm">刷新</button>

                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default active btn_platPostRate" dateGrp='stat_date' statType='day'>日</button>
                        <button type="button" class="btn btn-default btn_platPostRate" dateGrp='week_begin' statType='week'>周</button>
                        <button type="button" class="btn btn-default btn_platPostRate" dateGrp='month_num' statType='month'>月</button>
                    </div>
                </form>
            </div>
            
            <div id="platPostRate_EC" style="height:350px"></div>
        </div>
    </div> 
 -->

     <div class="datacontent" id="qsContent">
        <div class="dataTit">
            <i class="mark"></i><span>发布成功率趋势</span>
        </div>
        <div class="dataShow">
            <div id='catePostRateOption' dateGrp='post_rate'>
                <form class="form-inline">
<!--                     <div  class="input-group input-group-sm" style="width: 13%;float: left">
                        <span class="input-group-addon">
                            <input id="time_checkbox_catePostRate" type="checkbox">
                        </span>
                        <input id="time_input_catePostRate" type="text" class="form-control time" placeholder="添加对比" disabled>
                    </div> -->

                   <!--  <div class="form-group" style="width:140px;;margin-left:23%">
                        <label for="businessName">业务线：</label>
                        <select id="businessName" class="form-control input-sm"  style="width:80px;">
                            #foreach($buss in $businessList)
                                #if($buss != "total")
                                    <option value="$business_CN_Map.get("$buss")">$business_CN_Map.get("$buss")</option>
                                #end  
                            #end
                        </select>
                    </div>  -->
                     <div class="form-group" style="width:140px;;margin-left:33%">
                        <label for="post_rate_plat">平台：</label>
                        <select id="post_rate_plat" class="form-control input-sm"  style="width:80px;">
                                <option value="PC">PC</option>
                                <option value="M">M</option>
                                <option value="APP">APP</option>
                                <option value="手机QQ">手机QQ</option>
                                <option value="陌陌">陌陌</option>
                        </select>
                    </div> 

                  <!--   <div class="form-group" style="width:180px">
                        <label for="total_index">指标：</label>
                        <select id="total_index" name="total_index" class="form-control input-sm" style="align:center;">
                        <option value="post_rate">发布成功率</option>
                        <option value="nologin_post_rate">近似发布成功率</option>  
                        </select>
                    </div>   -->
            
                    <div class="form-group">
                        <label for="post_rate_cate">类别：</label>                       
                        <select id="post_rate_cate" class="form-control  input-sm">
                                    <option value="all">全部类别</option>              
                                    #foreach($!{cate} in ${cateTwoList})
                                        <option value="$!{cate}">
                                            $!{cate}
                                        </option>
                                    #end             
                        </select>  
                    </div>
                    <!-- <button id="refresh_catePostRate_btn" type="button" class="btn btn-default form-control input-sm">刷新</button> -->


                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default active btn_post_rate" dateGrp='post_rate'>总体</button>
                        <button type="button" class="btn btn-default btn_post_rate" dateGrp='nologin_post_rate'>近似个人</button>
                    </div>

                </form>           
            </div>
            
            <div>
                <div id="post_rate_EC" style="height:270px;"></div>
                <div id="fillPV_EC" style="height:270px;"></div>
            </div>

        </div>
    </div>     <!-- datacontent  -->
    
 
 

</div>
</body>
<script src="$!{__beat.server.contextPath}/bootstrap/jquery.js"></script>

<link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery-ui-1.9.2.custom.css" type="text/css" /> 
<link type="text/css" href="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery.multiselect.css" rel="stylesheet" />
<script src="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" src="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery.multiselect.js"></script>


<script src="$!{__beat.server.contextPath}/bootstrap/js/libs/bootstrap.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/bootstrap-datepicker.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/nongLiDate.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="$!{__beat.server.contextPath}/echarts2/source/echarts.js"></script>
<!-- <script src="$!{__beat.server.contextPath}/js/wnl.js"></script> -->
<script src="$!{__beat.server.contextPath}/bootstrap/js/App.js"></script>
<script type="text/javascript">
    var businessName = "$!{businessName}";
    var dayMap={1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六",0:"周日"};
	var datepicker_op={
        format: "yyyy-mm-dd",
        clearBtn: false,
        language: "zh-CN",
        autoclose: true,
        todayHighlight: true,
        minViewMode:0,
		orientation: "top left"
    };

	function getDate(yyyymmdd){
        if(yyyymmdd.length==10){        //yyyy-MM-dd
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(5,2)+'/'+yyyymmdd.substr(8,2));
        }else if(yyyymmdd.length==8){
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(4,2)+'/'+yyyymmdd.substr(6,2));
        }else if(yyyymmdd.length==6){
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(4,2));
        }
    }

    //获取星期几 dayDate 的格式为 yyyy-MM-dd
    function getWeekDay(dayDate){
        var jsDate = new Date(Date.parse(dayDate.replace(/\-/g,'/')));
        var weekNumber = jsDate.getDay();
        return dayMap[weekNumber];
    }

    function setDatePicker(ec,dateGrp,input){
        if('week_begin'==dateGrp){
        }else if('month_num'==dateGrp){
            datepicker_op.minViewMode=1;
            datepicker_op.format='yyyymm';
        }else{
            datepicker_op.minViewMode=0;
            datepicker_op.format='yyyy-mm-dd';
        }
        input.datepicker('remove');
        input.datepicker(datepicker_op);
        //获取显示的日期数组
        var days_show=ec.getShowDays();
        var days_all=ec.getAllDays();
        //设置时间可选范围
        input.datepicker('setStartDate',new Date(getDate(days_all[0])));
        input.datepicker('setEndDate',new Date(getDate(days_all[days_all.length-days_show.length])));
    }

    function changeDateGrp(item){
        var dateGrpVal = $(item).attr('dateGrp');
        var stat_type = $(item).attr('statType');
        var curDiv = $(item).closest('div[dateGrp]');
        $(curDiv).attr('dateGrp',dateGrpVal).attr('statType',stat_type);
    }

    function changeIndex(item){
        var indexVal = $(item).val();
        var curDiv = $(item).closest('div[dateGrp]');
        $(curDiv).attr('indexType',indexVal);
    }

    $('.btn-tab button').click(function(e){
        $(this).addClass('active');
        $(this).siblings('button').each(function(){
            $(this).removeClass('active');
        });
    });

    // 路径配置
    require.config({paths: {echarts: "$!{__beat.server.contextPath}/echarts2/dist",dashboard: "$!{__beat.server.contextPath}/js/info"}});
	
    var charts = [];

    //业务线发布成功率多维柱状图
    require(['dashboard/post_rate_cate_v0'],function(totalEC){
        charts.push(totalEC);
        totalEC.show(businessName,2);
    });  

    // require(['echarts','echarts/chart/line','echarts/chart/bar'],);       

	
    //格式化输出数字
	function format_number(n){
        var b=parseInt(n).toString(); 
        var len=b.length; 
        if(len<=3){return b;} 
        var r=len%3; 
        return r>0?b.slice(0,r)+","+b.slice(r,len).match(/\d{3}/g).join(","):b.slice(r,len).match(/\d{3}/g).join(","); 
    };

    $(window).resize(function(){
        $.each(charts,function(i,n){
            n.resize();
        });
    });

</script>
</html>